package cn.tedu._07springaop.aop;

import org.springframework.stereotype.Component;

@Component
public class CalculatorImpl implements Calculator{
    @Override
    public int add(int a, int b) {
        System.out.println("执行了add方法");
        if (a > 0){
            throw new IllegalArgumentException("a不能大于0");
        }
        int result = a + b;
        System.out.println("add方法结束");
        return result;
    }
    @Override
    public int sub(int a, int b) {
//        System.out.println("执行了sub方法");
        int result = a - b;
        System.out.println("sub方法结束");
        return result;
    }
    @Override
    public int mul(int a, int b) {
//        System.out.println("执行了mul方法");
        int result = a * b;
        System.out.println("mul方法结束");
        return result;
    }
    @Override
    public int div(int a, int b) {
//        System.out.println("执行了div方法");
        int result = a / b;
        System.out.println("div方法结束");
        return result;
    }
}
